package com.rt.nettysocketio;

import com.rt.nettysocketio.SocketIOService.SocketIOService;
import com.rt.nettysocketio.dto.PushMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * TODO().
 *
 * <p>TODO().
 *
 * <p>版权所有:Copyright (c) 2019<br/>
 * <a href="http://www.wiseimage.cn/">广州易联众睿图信息技术有限公司</a>.
 *
 * @author 周昭名
 * @version V1.0
 * @since 2020/6/4 15:38
 */
@Controller
@RequestMapping("/")
public class TestController {
    @Autowired
    SocketIOService socketIOServiceImpl;
    @RequestMapping("test")
    public String toTestHtml(){
        return "test";
    }

    @RequestMapping("sendMsg")
    @ResponseBody
    public void sendMsg(String msg){
        PushMessage pushMessage = new PushMessage();
        pushMessage.setLoginUserNum("79");
        pushMessage.setContent(msg);
        pushMessage.setTime(System.currentTimeMillis());
        socketIOServiceImpl.pushMessageToUser(pushMessage);
    }
}
